package calbs.socket.packaging;

import calbs.socket.pojo.resp.RespAbLineListMsg;
import calbs.socket.pojo.resp.RespBaseMsg;
import calbs.socket.pojo.resp.RespData;
import calbs.socket.pojo.resp.RespFinishMsg;
import calbs.socket.tool.CHexConver;

import static java.lang.Integer.parseInt;

/**
 * Created by zhangqin on 2017/8/7.
 */
public class FinishPackagingImp implements PackagingI<RespFinishMsg>{


    @Override
    public String analysisMsg(RespData<RespFinishMsg> respData) {
        RespFinishMsg respFinishMsg = respData.getBody();
        String frameNumber = respFinishMsg.getFrameNumber();
        String content = CHexConver.integeroHexString(parseInt(frameNumber),4);
        content = content+CHexConver.integeroHexString(respFinishMsg.getReceiveContentLength(),4);
        return PackingUtils.packing(respData.getBody(),content);
    }
}
